// pages/album_template/album_template.js
var app = getApp()
Page({
  data:{
    domain:app.globalData.domain
  },
  onLoad:function(o){
    // 页面初始化 options为页面跳转所带来的参数
    var album = wx.getStorageSync('album_info_s')
   // console.log(album)
    this.setData({
      album:album
    })
    this.Get_Background(1)
  },


//获取表单数据 
  formSubmit(e){
    var t = this
    var album = wx.getStorageSync('album_info_s')
    album.Album_Border=e.detail.value.border
  //  console.log(album)
    wx.setStorageSync('album_info_s',album)
    wx.redirectTo({url:'../album_add/album_add'})
  },

//上下翻页
  Flip_Page(e){
    var flip = e.currentTarget.dataset.type
    var pnow = e.currentTarget.dataset.pnow
    if(flip == 'last'){
      if(this.data.bg_info.Pnow > 1){
        var last = this.data.bg_info.Pnow -1
      }else{
        last = 1
      }
      this.Get_Background(last)
    }else{
      if(this.data.bg_info.Pnow < this.data.bg_info.PageCount){
        var last = this.data.bg_info.Pnow + 1
      }else{
        var last = this.data.bg_info.PageCount
      }
      this.Get_Background(last)
    }
  },


//获取相框
  Get_Background(pnow){
  	var t = this
  	wx.request({
  		url:app.globalData.urls,
  		data:{
  			"GetTypes":'Get_Border',
  			"pnow":pnow
  		},
  		success:function(res){
  			t.setData({
  				bg_info:res.data
  			})
  			console.log(res.data)
  		}
  	})
  }



})